﻿using System.ComponentModel;

namespace c2iGMailNotifier.Model
{
    public class User : INotifyPropertyChanged
    {
        #region UserName Property

        /// <summary>
        /// The <see cref="UserName" /> property's name.
        /// </summary>
        public const string PropertyNamePropertyName = "UserName";

        private string _userName;

        public string UserName
        {
            get { return this._userName; }

            set
            {
                if (this._userName == value) return;

                this._userName = value;
                RaisePropertyChanged(PropertyNamePropertyName);
            }
        }

        #endregion

        #region Password Property

        /// <summary>
        /// The <see cref="Password" /> property's name.
        /// </summary>
        public const string PasswordPropertyName = "Password";

        private string _password;

        public string Password
        {
            get { return this._password; }

            set
            {
                if (this._password == value) return;

                this._password = value;
                RaisePropertyChanged(PasswordPropertyName);
            }
        }

        #endregion

        #region RefreshInterval Property

        /// <summary>
        /// The <see cref="RefreshInterval" /> property's name.
        /// </summary>
        public const string RefreshIntervalPropertyName = "RefreshInterval";

        private int _refreshInterval = 5;

        /// <summary>
        /// Interval (in minutes) between two interrogation of GMail feed.
        /// </summary>
        public int RefreshInterval
        {
            get { return this._refreshInterval; }

            set
            {
                if (this._refreshInterval == value) return;

                this._refreshInterval = value;
                RaisePropertyChanged(RefreshIntervalPropertyName);
            }
        }

        #endregion

        #region NotificationSoundFileName Property

        /// <summary>
        /// The <see cref="NotificationSoundFileName" /> property's name.
        /// </summary>
        public const string NotificationSoundFileNamePropertyName = "NotificationSoundFileName";

        private string _notificationSoundFileName;

        public string NotificationSoundFileName
        {
            get { return this._notificationSoundFileName; }

            set
            {
                if (this._notificationSoundFileName == value) return;

                this._notificationSoundFileName = value;
                RaisePropertyChanged(NotificationSoundFileNamePropertyName);
            }
        }

        #endregion  

        #region INotifyPropertyChanged Membres

        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion
    }
}